home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.cs.arizona.edu
/
ftp.cs.arizona.edu.tar
/
ftp.cs.arizona.edu
/
icon
/
newsgrp
/
group97b.txt
/
000095_icon-group-sender _Fri Oct 24 13:14:40 1997.msg
< prev
next >
Wrap
Internet Message Format
|
2000-09-20
|
4KB
Return-Path: <icon-group-sender>
Received: from kingfisher.CS.Arizona.EDU (kingfisher.CS.Arizona.EDU [192.12.69.239])
by cheltenham.cs.arizona.edu (8.8.7/8.8.7) with SMTP id NAA28882
for <icon-group-addresses@cheltenham.CS.Arizona.EDU>; Fri, 24 Oct 1997 13:14:39 -0700 (MST)
Received: by kingfisher.CS.Arizona.EDU (5.65v4.0/1.1.8.2/08Nov94-0446PM)
id AA24995; Fri, 24 Oct 1997 13:14:39 -0700
From: gep2@computek.net
Date: Fri, 24 Oct 1997 12:54:16 -0500
Message-Id: <199710241754.MAA08555@axp.cmpu.net>
Mime-Version: 1.0
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
Subject: Re: tabulating values
To: icon-group@cs.arizona.edu
X-Mailer: SPRY Mail Version: 04.00.06.17
Errors-To: icon-group-errors@cs.arizona.edu
Status: RO
> Well, I've now received six responses to my query, none of which provide a
solution to the problem.
Why are you asking those of us on the Net to do things for you which would
appear to be your homework assignments?
> I really do appreciate the responses, but four of the responses consisted of
people essentially saying "Heck, that's trivial" without proving it by actually
providing a working solution
It's NOT as if something so evident requires a "proof".
> and the two responses that did actually contain code failed to provide a
solution.
OK, let me give you a SNOBOL4/SPITBOL version of your "solution":
-plusops 1 ;* (for SNOBOL4+ only)
t = table()
rdrec line = input :f(donerd)
tabnum line span("0123456789") . n = :f(rdrec)
t[+n] = t[+n] + 1 :(tabnum)
donerd a = sort(t,1) :f(end)
output = "number count"
outlp output = rpad(a[(i = i + 1),1],9) a[i,2] :s(outlp)
end
The FACT, Stuart, is that my original post holds true. If you compare this
program against the word count program (which you will CERTAINLY find in the
Icon Program Library) you'll see that the technique used is essentially
identical, except that (1) one is spanning numeric characters instead of
alphabetic ones, and (2) the "+" used in front of the table index to make it
integer type rather than string type. This program (or one nearly identical) is
probably an example program used in nearly every SNOBOL4/ICON book ever
published!!!
And with a fairly trivial upgrade to it it would also handle signed numbers and
decimal fractions, too.
But the bigger issue still remains: why do you think we should be doing
homework assignments for you, and why do you feel that we have to "prove"
anything at all to you? For you to even ASK here for such a trivial program is
to make it evident that you are unwilling (or unable) to pick up an Icon book
and READ it, or to give half a moment's effort to trying to learn how to use
this language. And either case is sad, because the language really is far too
useful and interesting for you to devote such a pathetically poor effort to
learning to use and understand it. (And besides, if you can't figure out the
beginning-level stuff like this, you're NEVER going to successfully finish your
later class assignments, anyhow, which will be complicated enough that you're
not going to find people here on the newsgroup who will post working-and-tested
solutions for you!).
Gordon Peterson
http://www.computek.net/public/gep2/
Support the Anti-SPAM Amendment! Join at http://www.cauce.org/